package xin.marcher.wind.process.config;

import org.dom4j.Document;
import org.dom4j.io.SAXReader;

import java.io.StringReader;

/**
 * @author marcher
 */
public class StringXmlProcessParser extends AbstractXmlProcessParser {

    private String xmlConfig;

    public StringXmlProcessParser() {
    }

    public StringXmlProcessParser(String xmlConfig) {
        this.xmlConfig = xmlConfig;
    }

    @Override
    protected Document getDocument() throws Exception {
        SAXReader saxReader = new SAXReader();
        StringReader reader = new StringReader(xmlConfig);
        return saxReader.read(reader);
    }

    public void setXmlConfig(String xmlConfig) {
        this.xmlConfig = xmlConfig;
    }
}
